package com.bl.student.manager.controller.point;

import com.bl.student.common.ApiResponseBody;
import com.bl.student.manager.controller.BaseController;
import com.bl.student.service.biz.point.PointService;
import com.bl.student.service.biz.task.TaskService;
import com.bl.student.service.vo.point.PointModVo;
import com.bl.student.service.vo.point.PointTypeListVo;
import com.bl.student.service.vo.teacher.TeacherListVo;
import com.bl.student.service.vo.teacher.TeacherModVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;


@RestController
@Log4j2
@RequestMapping(value = {"/student/manager/point"})
@Api(value = "积分类型管理", description = "积分类型管理")
public class PointController extends BaseController {
    @Autowired
    PointService pointService;

    @ApiOperation(value = "修改积分管理信息", notes = "修改积分管理信息 ")
    @ApiImplicitParams({})
    @PostMapping(value = {"/mod"})
    public ApiResponseBody modify(
            @Valid @RequestBody PointModVo body, BindingResult result,
            HttpServletRequest request) {

        ApiResponseBody validResult = validParams(result);
        if (validResult != null) {
            return validResult;
        }

        pointService.mod(body);

        return ApiResponseBody.createSuccessBody(null);
    }
    @ApiOperation(value = "积分类型列表", notes = "积分类型列表")
    @ApiImplicitParams({})
    @GetMapping(value = {"/get_list"})
    public ApiResponseBody<TeacherListVo> getList(HttpServletRequest request) {

        PointTypeListVo pointTypeListVo = pointService.getPointTypeList();

        return ApiResponseBody.createSuccessBody(pointTypeListVo);
    }


}
